package com.mrd.gtimp.business.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Transient;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import com.mrd.annotation.validation.MRDLength;
import com.mrd.gtimp.base.entity.User;
import com.mrd.gtimp.business.service.DeclarationBiz;
import com.mrd.gtimp.order.entity.DeclaContainer;
import com.mrd.gtimp.order.entity.DeclaContainerModel;
import com.mrd.util.PkCleanerUtil;
import com.mrd.util.PkConfig;

/**
 * 报关模版信息
 * 
 * @author lenovo
 */
@Entity(name = "T_BIZ_DECLARATION_MODEL")
public class DeclarationModel extends BaseBusinessModel implements Serializable {

  /**
   *
   */
  private static final long serialVersionUID = -687176883848512156L;
  @Resource(name = "declarationBiz")
  private static DeclarationBiz declarationBiz;

  // ------------------------------------------ 3.0 gtimp
  /**
   * 统一编号
   */
  @Column(name = "unity_no")
  private String unityNo;

  /**
   * 申报状态
   */
  @Column(name = "declare_state")
  private String declareState;

  /**
   * 集装箱信息表
   */
  // @OneToMany(mappedBy = "declaration", cascade = CascadeType.ALL)
  // private List<DeclaContainerModel> declaContainers;

  /**
   * 经营单位编号（收发货人）
   */
  // private String company_co;

  /**
   * + 经营单位编号（收发货人）代码
   */
  @Column(name = "COMPANY_NAME_")
  private String companyName;

  /**
   * 转关提前报关
   */
  @Column(name = "declar_up")
  private String declarUp;

  // ------------------------------------------- 2.0 gtimp

  /**
   * 预录入编号,报关单号
   */
  private String sno;
  /**
   * 提单号
   */
  private String bl_no;
  /**
   * 经营单位编号
   */
  private String company_co;
  /**
   * 发货单位编号
   */
  private String fahuo_company_co;
  /**
   * 运输工具名称
   */
  private String transport_na;
  /**
   * 航次号
   */
  private String voyage_no;
  /**
   * 运抵国
   */
  private String arrived_country;
  /**
   * 运抵国代码
   */
  private String arrived_country_code;
  /**
   * 指运港
   */
  private String arrived_port;
  /**
   * 指运港代码
   */
  private String arrived_port_code;
  /**
   * 境内货源地
   */
  private String goods_addr;
  /**
   * 境内货源地代码
   */
  private String goods_addr_code;
  /**
   * 其他货源地
   */
  private String other_goods_addr;
  /**
   * 批准文号
   */
  private String approval_no;
  /**
   * 成交方式
   */
  private String deal_mode;
  /**
   * 件数
   */
  private String goods_count;
  /**
   * 包装种类
   */
  private String goods_package;
  /**
   * 净重
   */
  private String net_weight;
  /**
   * 备注
   */
  private String remark;
  /**
   * 贸易方式/监管方式
   */
  private String trade_mode;
  /**
   * 贸易方式/监管方式代码
   */
  private String trade_mode_code;
  /**
   * 经营单位名称
   */
  private String company_name;
  /**
   * 运输方式
   */
  private String transport_mode;
  /**
   * 发货单位名称
   */
  private String fahuo_company_name;
  /**
   * 征免性质
   */
  private String levymode;
  /**
   * 征免性质代码
   */
  private String levymode_code;
  /**
   * 结汇方式
   */
  private String lc_type;
  /**
   * 合同协议号
   */
  private String contract_no;
  /**
   * 毛重
   */
  private String gross_weight;
  /**
   * 报关单类型
   */
  private String customs_type;
  /**
   * 备案号
   */
  private String record_id;
  /**
   * 出口日期
   */
  private Date export_date;
  /**
   * 申报日期
   */
  private Date report_date;
  /**
   * 生产厂家
   */
  private String produce_factory;
  /**
   * 申报单位编码
   */
  private String shenbao_company_co;
  /**
   * 申报单位名称
   */
  private String shenbao_company_name;
  /**
   * 运费数量
   */
  private String freight1;
  /**
   * 运费费率
   */
  private String freight2;
  /**
   * 运费币制
   */
  private String freight3;
  /**
   * 保费数量
   */
  private String premium1;
  /**
   * 保费费率
   */
  private String premium2;
  /**
   * 保费币制
   */
  private String premium3;
  /**
   * 杂费数量
   */
  private String otherfee1;
  /**
   * 杂费费率
   */
  private String otherfee2;
  /**
   * 杂费币制
   */
  private String otherfee3;
  /**
   * 关联报关单
   */
  private String re_manifest;
  /**
   * 关联备案
   */
  private String re_record_id;
  /**
   * 监管仓号
   */
  private String re_jianguan;
  /**
   * 货场代码
   */
  private String re_yard_id;
  /**
   * 出口口岸
   */
  private String export_port;
  /**
   * 出口口岸代码 / 进口口岸代码
   */
  @MRDLength(max = 15, name = "出口口岸代码 / 进口口岸代码")
  @Column(name = "EXPORT_PORT_CODE")
  private String export_port_code;
  /**
   * 纳税单位
   */
  private String tex_company;
  /**
   * 许可证号
   */
  private String license_no;
  /**
   * 随附单证
   */
  private String suifudan;
  /**
   * 船名
   */
  private String ship_name;
  /**
   * 报关报检业务状态
   */
  private String state;

  /**
   * 签约日期
   */
  private Date contract_date;

  /**
   * 制单日期
   */
  private Date making_date;

  /**
   * 签约地点
   */
  private String singing_place;

  /**
   * 具体包装种类
   */
  private String concrete_goods_package;

  /**
   * 商品信息
   */
  @OneToMany(mappedBy = "declaration")
  private List<CommodityModel> commodities;

  /**
   * 随附单信息
   */
  @OneToMany(mappedBy = "declaration", cascade = CascadeType.ALL, orphanRemoval = true)
  private List<SuiFuDanModel> suiFuDans;

  /**
   * 集装箱信息
   */
  @OneToMany(mappedBy = "declaration", cascade = CascadeType.ALL, orphanRemoval = true)
  private List<DeclaContainerModel> declaContainers;

  @OneToOne(mappedBy = "declaration", cascade = CascadeType.ALL, orphanRemoval = true)
  private DeclarationModelInform declarationInform;

  /**
   * 卖家
   */
  private String seller;

  /**
   * 卖家地址
   */
  private String seller_address;

  /**
   * 卖家电话
   */
  private String seller_phone;

  /**
   * 卖家传真
   */
  private String seller_fax;

  /**
   * 箱唛
   */
  private String carton;

  /**
   * 买方
   */
  private String buyer;

  /**
   * 发票号
   */
  private String invoice_no;

  /**
   * 合同备注
   */
  private String contract_remark;

  /**
   * 货物总金额
   */
  private String total_money;

  /**
   * 总计价数量
   */
  private String sum_count;

  private String is_record_info;

  /**
   * 申报口岸
   */
  private String declaration_port;
  /**
   * 申报口岸代码
   */
  private String declaration_port_code;

  /**
   * 贸易国
   */
  private String trading_country;
  /**
   * 贸易国代码
   */
  private String trading_country_code;
  /**
   * 特殊关系确认
   */
  private String special_relationship_confirm;
  /**
   * 价格影响确认
   */
  private String price_impact_confirm;
  /**
   * 支付特许权使用费确认
   */
  private String payment_royaltils_confirm;
  /**
   * 经营单位编号18位社会统一代码
   */
  private String company_co_unite;
  /**
   * 发货单位编号18位社会统一代码
   */
  private String fahuo_company_co_unite;
  /**
   * 发货单位编号18位社会统一代码
   */
  private String shenbao_company_co_unite;

  /**
   * 以下信息为反馈信息
   */
  /**
   * 海关放行时间
   */
  @Column(name = "CUSTOM_TIME")
  private Date custom_time;
  /**
   * 海关放行信息(报关状态)
   */
  @Column(name = "CUSTOM_STATUS")
  private String custom_status;
  /**
   * 商检放行时间
   */
  @Column(name = "CHECK_TIME")
  private Date check_time;
  /**
   * 商检放行信息(报检状态)
   */
  @Column(name = "CHECK_STATUS")
  private String check_status;

  /**
   * 集装箱号
   */
  @Column(name = "CONTAINER_NO")
  private String container_no;

  /**
   * SO号
   */
  @Column(name = "SO")
  private String so;

  /**
   * 报关单进出口类型，E出口，I进口
   */
  @Column(name = "DECLARATION_TYPE")
  private String declaration_type;
  /**
   * 贸易类型 0一般贸易，1加工贸易，2特殊贸易
   */
  @Column(name = "TRADE_TYPE_")
  private String tradeType;

  /**
   * 有无木质包装
   */
  @Column(name = "IS_WOOD_PACKAGING")
  private String is_wood_packaging;

  /**
   * 记录客户的复制、使用模板、暂存、提交的动作 格式如：M3-s3-s3-s3-S3 或 s2-S2 或C3-S3-S3或E3-S3 C：复制，s:保存，S：提交，
   * M：使用模板，E：excl导入，2：2.0页面,3：3.0页面 被驳回的单可能会出现SS相接的情况
   */
  @Transient
  private String actionChain;

  /**
   * 是否通关一体化
   */
  @Column(name = "is_tongguan_yth")
  private String isTongguanYth;

  public List<CommodityModel> getCommodities() {
    return commodities;
  }

  public void setCommodities(List<CommodityModel> commodities) {
    this.commodities = commodities;
  }

  /**
   * 构造方法，通过字符串转换
   */
  public DeclarationModel(String declarationString) {
    fromString(declarationString);
  }

  public DeclarationModel(Declaration declaration) {
    /*
     * gtimp 3.0
     */
    // this.unityNo = declaration.getUnityNo();
    this.declareState = declaration.getDeclareState();
    // this.company_co = declaration.getCompany_co();
    this.declarUp = declaration.getDeclarUp();
    /*
     * gtimp 2.0
     */
    this.declaration_type = declaration.getDeclaration_type();
    this.sno = declaration.getSno();
    this.bl_no = declaration.getBl_no();
    this.company_co = declaration.getCompany_co();
    this.fahuo_company_co = declaration.getFahuo_company_co();
    this.transport_na = declaration.getTransport_na();
    this.voyage_no = declaration.getVoyage_no();
    this.arrived_country = declaration.getArrived_country();
    this.arrived_country_code = declaration.getArrived_country_code();
    this.arrived_port = declaration.getArrived_port();
    this.arrived_port_code = declaration.getArrived_port_code();
    this.goods_addr = declaration.getGoods_addr();
    this.goods_addr_code = declaration.getGoods_addr_code();
    this.other_goods_addr = declaration.getOther_goods_addr();
    this.approval_no = declaration.getApproval_no();
    this.deal_mode = declaration.getDeal_mode();
    this.goods_count = declaration.getGoods_count();
    this.goods_package = declaration.getGoods_package();
    this.net_weight = declaration.getNet_weight();
    this.remark = declaration.getRemark();
    this.trade_mode = declaration.getTrade_mode();
    this.trade_mode_code = declaration.getTrade_mode_code();
    this.company_name = declaration.getCompany_name();
    this.transport_mode = declaration.getTransport_mode();
    this.fahuo_company_name = declaration.getFahuo_company_name();
    this.levymode = declaration.getLevymode();
    this.levymode_code = declaration.getLevymode_code();
    this.lc_type = declaration.getLc_type();
    this.contract_no = declaration.getContract_no();
    this.gross_weight = declaration.getGross_weight();
    this.customs_type = declaration.getCustoms_type();
    this.record_id = declaration.getRecord_id();
    this.export_date = declaration.getExport_date();
    // this.report_date = declaration.getReport_date();
    this.produce_factory = declaration.getProduce_factory();
    this.shenbao_company_co = declaration.getShenbao_company_co();
    this.shenbao_company_name = declaration.getShenbao_company_name();
    this.freight1 = declaration.getFreight1();
    this.freight2 = declaration.getFreight2();
    this.freight3 = declaration.getFreight3();
    this.premium1 = declaration.getPremium1();
    this.premium2 = declaration.getPremium2();
    this.premium3 = declaration.getPremium3();
    this.otherfee1 = declaration.getOtherfee1();
    this.otherfee2 = declaration.getOtherfee2();
    this.otherfee3 = declaration.getOtherfee3();
    this.re_manifest = declaration.getRe_manifest();
    this.re_record_id = declaration.getRe_record_id();
    this.re_jianguan = declaration.getRe_jianguan();
    this.re_yard_id = declaration.getRe_yard_id();
    this.export_port = declaration.getExport_port();
    this.tex_company = declaration.getTex_company();
    this.license_no = declaration.getLicense_no();
    this.suifudan = declaration.getSuifudan();
    this.ship_name = declaration.getShip_name();
    this.state = declaration.getState();
    this.contract_date = declaration.getContract_date();
    this.commodities = new ArrayList<CommodityModel>();
    if (CollectionUtils.isNotEmpty(declaration.getCommodities())) {
      for (Commodity commodity : declaration.getCommodities()) {
        this.commodities.add(new CommodityModel(commodity));
      }
    }
    this.suiFuDans = new ArrayList<SuiFuDanModel>();
    if (CollectionUtils.isNotEmpty(declaration.getSuiFuDans())) {
      for (SuiFuDan suiFuDan : declaration.getSuiFuDans()) {
        suiFuDans.add(new SuiFuDanModel(suiFuDan));
      }
    }
    this.declaContainers = new ArrayList<DeclaContainerModel>();
    if (CollectionUtils.isNotEmpty(declaration.getDeclaContainers())) {
      for (DeclaContainer container : declaration.getDeclaContainers()) {
        declaContainers.add(new DeclaContainerModel(container));
      }
    }
    DeclarationInform declarationInform = declaration.getDeclarationInform();
    if (declarationInform != null) {
      this.declarationInform = new DeclarationModelInform(declarationInform);
    }
    this.seller = declaration.getSeller();
    this.seller_address = declaration.getSeller_address();
    this.seller_phone = declaration.getSeller_phone();
    this.seller_fax = declaration.getSeller_fax();
    this.carton = declaration.getCarton();
    this.buyer = declaration.getBuyer();
    this.invoice_no = declaration.getInvoice_no();
    this.custom_time = declaration.getCustom_time();
    this.custom_status = declaration.getCustom_status();
    this.check_time = declaration.getCheck_time();
    this.check_status = declaration.getCheck_status();
    this.container_no = declaration.getContainer_no();
    this.so = declaration.getSo();
    this.is_record_info = declaration.getIs_record_info();
    this.declaration_port = declaration.getDeclaration_port();
    this.declaration_port_code = declaration.getDeclaration_port_code();
    this.trading_country = declaration.getTrading_country();
    this.trading_country_code = declaration.getTrading_country_code();
    this.special_relationship_confirm = declaration.getSpecial_relationship_confirm();
    this.price_impact_confirm = declaration.getPrice_impact_confirm();
    this.payment_royaltils_confirm = declaration.getPayment_royaltils_confirm();
    this.company_co_unite = declaration.getCompany_co_unite();
    this.fahuo_company_co_unite = declaration.getFahuo_company_co_unite();
    this.shenbao_company_co_unite = declaration.getShenbao_company_co_unite();
    this.tradeType = declaration.getTradeType();

    /* super.setId(declaration.getId()); */
    if (declaration.getShipper() != null) {
      super.setShipper(new ContacterModel(declaration.getShipper()));
    }
    super.setCustomer(declaration.getCustomer());
    super.setCreator(declaration.getCreator());
    super.setCtime(declaration.getCtime());
    super.setModifier(declaration.getModifier());
    super.setMtime(declaration.getMtime());
    super.setBusinessId(null);
    super.setType(declaration.getType());
    super.setSupCompany(declaration.getSupCompany());
    super.setRealSupId(declaration.getRealSupId());
    super.setBpk(declaration.getBpk());
    super.setConfirmTime(declaration.getConfirmTime());
    super.setValidateTime(declaration.getValidateTime());
    super.setValidator_ext(declaration.getValidator_ext());
    super.setValidator(declaration.getValidator());
    super.setUpload_time(declaration.getUpload_time());
    super.setUploader_ext(declaration.getUploader_ext());
    super.setUploader(declaration.getUploader());
    super.setFinish_time(declaration.getFinish_time());
    super.setFinisher_ext(declaration.getFinisher_ext());
    super.setFinisher(declaration.getFinisher());
  }

  public DeclarationModel() {
    super();
  }

  /*
   * (non-Javadoc)
   * 
   * @see com.mrd.gtimp.business.entity.BaseBusinessModel#fromString(java.lang.String)
   */
  @Override
  public BaseBusinessModel fromString(String businessString) {
    return null;
  }

  /*
   * (non-Javadoc)
   * 
   * @see com.mrd.gtimp.business.entity.BaseBusinessModel#toString()
   */
  @Override
  public String toString() {
    return null;
  }

  public String getSno() {
    return sno;
  }

  public void setSno(String sno) {
    this.sno = sno;
  }

  public String getBl_no() {
    return bl_no;
  }

  public void setBl_no(String bl_no) {
    this.bl_no = bl_no;
  }

  public String getCompany_co() {
    return company_co;
  }

  public void setCompany_co(String company_co) {
    this.company_co = company_co;
  }

  public String getFahuo_company_co() {
    return fahuo_company_co;
  }

  public void setFahuo_company_co(String fahuo_company_co) {
    this.fahuo_company_co = fahuo_company_co;
  }

  public String getTransport_na() {
    return transport_na;
  }

  public void setTransport_na(String transport_na) {
    this.transport_na = transport_na;
  }

  public String getVoyage_no() {
    return voyage_no;
  }

  public void setVoyage_no(String voyage_no) {
    this.voyage_no = voyage_no;
  }

  public String getArrived_country() {
    return arrived_country;
  }

  public void setArrived_country(String arrived_country) {
    this.arrived_country = arrived_country;
  }

  public String getArrived_port() {
    return arrived_port;
  }

  public void setArrived_port(String arrived_port) {
    this.arrived_port = arrived_port;
  }

  public String getGoods_addr() {
    return goods_addr;
  }

  public void setGoods_addr(String goods_addr) {
    this.goods_addr = goods_addr;
  }

  public String getApproval_no() {
    return approval_no;
  }

  public void setApproval_no(String approval_no) {
    this.approval_no = approval_no;
  }

  public String getDeal_mode() {
    return deal_mode;
  }

  public void setDeal_mode(String deal_mode) {
    this.deal_mode = deal_mode;
  }

  public String getGoods_count() {
    return goods_count;
  }

  public void setGoods_count(String goods_count) {
    this.goods_count = goods_count;
  }

  public String getGoods_package() {
    return goods_package;
  }

  public void setGoods_package(String goods_package) {
    this.goods_package = goods_package;
  }

  public String getNet_weight() {
    return net_weight;
  }

  public void setNet_weight(String net_weight) {
    this.net_weight = net_weight;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public String getTrade_mode() {
    return trade_mode;
  }

  public void setTrade_mode(String trade_mode) {
    this.trade_mode = trade_mode;
  }

  public String getCompany_name() {
    return company_name;
  }

  public void setCompany_name(String company_name) {
    this.company_name = company_name;
  }

  public String getTransport_mode() {
    return transport_mode;
  }

  public void setTransport_mode(String transport_mode) {
    this.transport_mode = transport_mode;
  }

  public String getFahuo_company_name() {
    return fahuo_company_name;
  }

  public void setFahuo_company_name(String fahuo_company_name) {
    this.fahuo_company_name = fahuo_company_name;
  }

  public String getLevymode() {
    return levymode;
  }

  public void setLevymode(String levymode) {
    this.levymode = levymode;
  }

  public String getLc_type() {
    return lc_type;
  }

  public void setLc_type(String lc_type) {
    this.lc_type = lc_type;
  }

  public String getContract_no() {
    return contract_no;
  }

  public void setContract_no(String contract_no) {
    this.contract_no = contract_no;
  }

  public String getGross_weight() {
    return gross_weight;
  }

  public void setGross_weight(String gross_weight) {
    this.gross_weight = gross_weight;
  }

  public String getCustoms_type() {
    return customs_type;
  }

  public void setCustoms_type(String customs_type) {
    this.customs_type = customs_type;
  }

  public String getRecord_id() {
    return record_id;
  }

  public void setRecord_id(String record_id) {
    this.record_id = record_id;
  }

  public Date getExport_date() {
    return export_date;
  }

  public void setExport_date(Date export_date) {
    this.export_date = export_date;
  }

  public String getShenbao_company_co() {
    return shenbao_company_co;
  }

  public void setShenbao_company_co(String shenbao_company_co) {
    this.shenbao_company_co = shenbao_company_co;
  }

  public String getShenbao_company_name() {
    return shenbao_company_name;
  }

  public void setShenbao_company_name(String shenbao_company_name) {
    this.shenbao_company_name = shenbao_company_name;
  }

  public String getFreight1() {
    return freight1;
  }

  public void setFreight1(String freight1) {
    this.freight1 = freight1;
  }

  public String getFreight2() {
    return freight2;
  }

  public void setFreight2(String freight2) {
    this.freight2 = freight2;
  }

  public String getFreight3() {
    return freight3;
  }

  public void setFreight3(String freight3) {
    this.freight3 = freight3;
  }

  public String getPremium1() {
    return premium1;
  }

  public void setPremium1(String premium1) {
    this.premium1 = premium1;
  }

  public String getPremium2() {
    return premium2;
  }

  public void setPremium2(String premium2) {
    this.premium2 = premium2;
  }

  public String getPremium3() {
    return premium3;
  }

  public void setPremium3(String premium3) {
    this.premium3 = premium3;
  }

  public String getOtherfee1() {
    return otherfee1;
  }

  public void setOtherfee1(String otherfee1) {
    this.otherfee1 = otherfee1;
  }

  public String getOtherfee2() {
    return otherfee2;
  }

  public void setOtherfee2(String otherfee2) {
    this.otherfee2 = otherfee2;
  }

  public String getOtherfee3() {
    return otherfee3;
  }

  public void setOtherfee3(String otherfee3) {
    this.otherfee3 = otherfee3;
  }

  public String getRe_manifest() {
    return re_manifest;
  }

  public void setRe_manifest(String re_manifest) {
    this.re_manifest = re_manifest;
  }

  public String getRe_record_id() {
    return re_record_id;
  }

  public void setRe_record_id(String re_record_id) {
    this.re_record_id = re_record_id;
  }

  public String getRe_jianguan() {
    return re_jianguan;
  }

  public void setRe_jianguan(String re_jianguan) {
    this.re_jianguan = re_jianguan;
  }

  public String getRe_yard_id() {
    return re_yard_id;
  }

  public void setRe_yard_id(String re_yard_id) {
    this.re_yard_id = re_yard_id;
  }

  public String getExport_port() {
    return export_port;
  }

  public void setExport_port(String export_port) {
    this.export_port = export_port;
  }

  public String getTex_company() {
    return tex_company;
  }

  public void setTex_company(String tex_company) {
    this.tex_company = tex_company;
  }

  public String getLicense_no() {
    return license_no;
  }

  public void setLicense_no(String license_no) {
    this.license_no = license_no;
  }

  public String getSuifudan() {
    return suifudan;
  }

  public void setSuifudan(String suifudan) {
    this.suifudan = suifudan;
  }

  public String getShip_name() {
    return ship_name;
  }

  public void setShip_name(String ship_name) {
    this.ship_name = ship_name;
  }

  public String getState() {
    return state;
  }

  public void setState(String state) {
    this.state = state;
  }

  public List<SuiFuDanModel> getSuiFuDans() {
    return suiFuDans;
  }

  public void setSuiFuDans(List<SuiFuDanModel> suiFuDans) {
    this.suiFuDans = suiFuDans;
  }

  public void setDecState(String state) {
    setState(state);
  }

  public Object getDecState() {
    return getState();
  }

  public DeclarationModelInform getDeclarationInform() {
    return declarationInform;
  }

  public void setDeclarationInform(DeclarationModelInform declarationInform) {
    this.declarationInform = declarationInform;
  }

  public Date getCustom_time() {
    return custom_time;
  }

  public void setCustom_time(Date custom_time) {
    this.custom_time = custom_time;
  }

  public String getCheck_status() {
    return check_status;
  }

  public void setCheck_status(String check_status) {
    this.check_status = check_status;
  }

  public Date getCheck_time() {
    return check_time;
  }

  public void setCheck_time(Date check_time) {
    this.check_time = check_time;
  }

  public String getCustom_status() {
    return custom_status;
  }

  public void setCustom_status(String custom_status) {
    this.custom_status = custom_status;
  }

  public Date getReport_date() {
    return report_date;
  }

  public void setReport_date(Date report_date) {
    this.report_date = report_date;
  }

  public String getProduce_factory() {
    return produce_factory;
  }

  public void setProduce_factory(String produce_factory) {
    this.produce_factory = produce_factory;
  }

  public String getContainer_no() {
    return container_no;
  }

  public void setContainer_no(String container_no) {
    this.container_no = container_no;
  }

  public String getSeller() {
    return seller;
  }

  public void setSeller(String seller) {
    this.seller = seller;
  }

  public String getSeller_address() {
    return seller_address;
  }

  public void setSeller_address(String seller_address) {
    this.seller_address = seller_address;
  }

  public String getSeller_phone() {
    return seller_phone;
  }

  public void setSeller_phone(String seller_phone) {
    this.seller_phone = seller_phone;
  }

  public String getSeller_fax() {
    return seller_fax;
  }

  public void setSeller_fax(String seller_fax) {
    this.seller_fax = seller_fax;
  }

  public String getCarton() {
    return carton;
  }

  public void setCarton(String carton) {
    this.carton = carton;
  }

  public String getBuyer() {
    return buyer;
  }

  public void setBuyer(String buyer) {
    this.buyer = buyer;
  }

  public String getInvoice_no() {
    return invoice_no;
  }

  public void setInvoice_no(String invoice_no) {
    this.invoice_no = invoice_no;
  }

  public String getContract_remark() {
    return contract_remark;
  }

  public void setContract_remark(String contract_remark) {
    this.contract_remark = contract_remark;
  }

  public String getTotal_money() {
    return total_money;
  }

  public void setTotal_money(String total_money) {
    this.total_money = total_money;
  }

  public String getSum_count() {
    return sum_count;
  }

  public void setSum_count(String sum_count) {
    this.sum_count = sum_count;
  }

  public Date getContract_date() {
    return contract_date;
  }

  public void setContract_date(Date contract_date) {
    this.contract_date = contract_date;
  }

  public Date getMaking_date() {
    return making_date;
  }

  public void setMaking_date(Date making_date) {
    this.making_date = making_date;
  }

  public String getSinging_place() {
    return singing_place;
  }

  public void setSinging_place(String singing_place) {
    this.singing_place = singing_place;
  }

  public String getConcrete_goods_package() {
    return concrete_goods_package;
  }

  public void setConcrete_goods_package(String concrete_goods_package) {
    this.concrete_goods_package = concrete_goods_package;
  }

  @Override
  public void clearPk() throws Exception {
    PkConfig[] configs = {new PkConfig("id", String.class), new PkConfig("CREATOR", String.class),
        new PkConfig("CTIME|O", Date.class), new PkConfig("MODIFIER", String.class),
        new PkConfig("MTIME|O", Date.class), new PkConfig("CONFIRM_TIME|O", Date.class),
        new PkConfig("VALIDATE_TIME|O", Date.class), new PkConfig("validator_ext", String.class),
        new PkConfig("validator|O", User.class), new PkConfig("upload_time|O", Date.class),
        new PkConfig("uploader_ext", String.class), new PkConfig("uploader|O", User.class),
        new PkConfig("finish_time|O", Date.class), new PkConfig("finisher_ext", String.class),
        new PkConfig("finisher|O", User.class), new PkConfig("state", String.class),
        new PkConfig("declarationInform|O", DeclarationInform.class)};
    PkCleanerUtil.clearPk(this, configs);
    for (CommodityModel c : commodities) {
      PkConfig[] cconfigs = {new PkConfig("id", String.class),

          new PkConfig("declaration|O", Declaration.class)};
      PkCleanerUtil.clearPk(c, cconfigs);
    }

    for (SuiFuDanModel s : suiFuDans) {
      PkConfig[] cconfigs = {new PkConfig("id", String.class),

          new PkConfig("declaration|O", Declaration.class)};
      PkCleanerUtil.clearPk(s, cconfigs);
    }
  }

  public String getSo() {
    return so;
  }

  public void setSo(String so) {
    this.so = so;
  }

  public String getIs_record_info() {
    return is_record_info;
  }

  public void setIs_record_info(String is_record_info) {
    this.is_record_info = is_record_info;
  }

  public String getOther_goods_addr() {
    return other_goods_addr;
  }

  public void setOther_goods_addr(String other_goods_addr) {
    this.other_goods_addr = other_goods_addr;
  }

  public String getArrived_country_code() {
    return arrived_country_code;
  }

  public void setArrived_country_code(String arrived_country_code) {
    this.arrived_country_code = arrived_country_code;
  }

  public String getArrived_port_code() {
    return arrived_port_code;
  }

  public void setArrived_port_code(String arrived_port_code) {
    this.arrived_port_code = arrived_port_code;
  }

  public String getGoods_addr_code() {
    return goods_addr_code;
  }

  public void setGoods_addr_code(String goods_addr_code) {
    this.goods_addr_code = goods_addr_code;
  }

  public String getLevymode_code() {
    return levymode_code;
  }

  public void setLevymode_code(String levymode_code) {
    this.levymode_code = levymode_code;
  }

  public String getDeclaration_port() {
    return declaration_port;
  }

  public void setDeclaration_port(String declaration_port) {
    this.declaration_port = declaration_port;
  }

  public String getDeclaration_port_code() {
    return declaration_port_code;
  }

  public void setDeclaration_port_code(String declaration_port_code) {
    this.declaration_port_code = declaration_port_code;
  }

  public String getTrade_mode_code() {
    return trade_mode_code;
  }

  public void setTrade_mode_code(String trade_mode_code) {
    this.trade_mode_code = trade_mode_code;
  }

  public String getTrading_country() {
    return trading_country;
  }

  public void setTrading_country(String trading_country) {
    this.trading_country = trading_country;
  }

  public String getTrading_country_code() {
    return trading_country_code;
  }

  public void setTrading_country_code(String trading_country_code) {
    this.trading_country_code = trading_country_code;
  }

  public String getSpecial_relationship_confirm() {
    return special_relationship_confirm;
  }

  public void setSpecial_relationship_confirm(String special_relationship_confirm) {
    this.special_relationship_confirm = special_relationship_confirm;
  }

  public String getPrice_impact_confirm() {
    return price_impact_confirm;
  }

  public void setPrice_impact_confirm(String price_impact_confirm) {
    this.price_impact_confirm = price_impact_confirm;
  }

  public String getPayment_royaltils_confirm() {
    return payment_royaltils_confirm;
  }

  public void setPayment_royaltils_confirm(String payment_royaltils_confirm) {
    this.payment_royaltils_confirm = payment_royaltils_confirm;
  }

  public String getCompany_co_unite() {
    return company_co_unite;
  }

  public void setCompany_co_unite(String company_co_unite) {
    this.company_co_unite = company_co_unite;
  }

  public String getFahuo_company_co_unite() {
    return fahuo_company_co_unite;
  }

  public void setFahuo_company_co_unite(String fahuo_company_co_unite) {
    this.fahuo_company_co_unite = fahuo_company_co_unite;
  }

  public String getShenbao_company_co_unite() {
    return shenbao_company_co_unite;
  }

  public void setShenbao_company_co_unite(String shenbao_company_co_unite) {
    this.shenbao_company_co_unite = shenbao_company_co_unite;
  }

  public String getUnityNo() {
    return unityNo;
  }

  public void setUnityNo(String unityNo) {
    this.unityNo = unityNo;
  }

  public String getDeclareState() {
    return declareState;
  }

  public void setDeclareState(String declareState) {
    this.declareState = declareState;
  }

  public String getCompanyName() {
    return companyName;
  }

  public void setCompanyName(String companyName) {
    this.companyName = companyName;
  }

  public String getDeclarUp() {
    return declarUp;
  }

  public void setDeclarUp(String declarUp) {
    this.declarUp = declarUp;
  }

  public List<DeclaContainerModel> getDeclaContainers() {
    return declaContainers;
  }

  public void setDeclaContainers(List<DeclaContainerModel> declaContainers) {
    this.declaContainers = declaContainers;
  }

  public String getDeclaration_type() {
    return declaration_type;
  }

  public void setDeclaration_type(String declaration_type) {
    this.declaration_type = declaration_type;
  }

  public String getTradeType() {
    return tradeType;
  }

  public void setTradeType(String tradeType) {
    this.tradeType = tradeType;
  }

  public String getExport_port_code() {
    return export_port_code;
  }

  public void setExport_port_code(String export_port_code) {
    this.export_port_code = export_port_code;
  }

  public String getIs_wood_packaging() {
    return is_wood_packaging;
  }

  public void setIs_wood_packaging(String is_wood_packaging) {
    this.is_wood_packaging = is_wood_packaging;
  }

  public String getActionChain() {
    return actionChain;
  }

  public void setActionChain(String actionChain) {
    this.actionChain = actionChain;
  }

  public void clearActionChain() {
    this.actionChain = null;
  }

  public String getIsTongguanYth() {
    return isTongguanYth;
  }

  public void setIsTongguanYth(String isTongguanYth) {
    this.isTongguanYth = isTongguanYth;
  }

  public void setActionChain(Declaration.ChainModel chainModel, boolean isVersion3) {
    if (StringUtils.isEmpty(actionChain)) {
      actionChain = "";
    }
    if (isVersion3) {
      switch (chainModel) {
        case copy:
          actionChain += "-C3";
          break;
        case userExcl:
          actionChain += "-E3";
          break;
        case userModel:
          actionChain += "-M3";
          break;
        case save:
          actionChain += "-s3";
          break;
        case submit:
          actionChain += "-S3";

      }
    } else {
      switch (chainModel) {
        case copy:
          actionChain += "-C2";
          break;
        case userModel:
          actionChain += "-M2";
          break;
        case save:
          actionChain += "-s2";
          break;
        case submit:
          actionChain += "-S2";

      }
    }
    if (actionChain.indexOf("-") == 0) {
      actionChain = actionChain.replaceFirst("-", "");
    }
  }
}
